Fix flaky login provider picker focus assertion (#410) - #416
Conversation
alejandro-ao
left a comment
There was a problem hiding this comment.
Reviewed in an isolated worktree (see prior review). Test-only change; wait_for_scheduled_animations() is a correct, stronger flush than pause() under Textual 8.2.8; no coverage loss. Re-ran the two affected tests 10x plus the full login subset — all green. Full CI parity (pytest 1053 passed, ruff, format, mypy) verified locally after merging latest main into the branch.
alejandro-ao
left a comment
There was a problem hiding this comment.
Re-approving after branch sync with latest main (daab3b9). Content unchanged from prior approval; CI green, login subset re-verified locally.
alejandro-ao
left a comment
There was a problem hiding this comment.
Re-approving after sync with main (8c45bff). CI green; change content identical to prior approvals.
|
Thank you @alejandro-ao for the thorough review, testing, and feedback! This was actually my very first merged PR in open source, so I'm super grateful for your guidance. Looking forward to contributing more to the project! |
Resolves #410.
This PR implements the second approach outlined in the issue to fix the flaky focus assertion on the login provider picker screen:
Separation of Concerns: Removed the flaky assert search.has_focus check from the data filtering test (test_tui_login_api_provider_picker_filters_by_name_and_display_name), as filtering behavior doesn't rely on focus states. Changed pilot.pause() calls to pilot.wait_for_scheduled_animations() to flush asynchronous filter events reliably.
Dedicated Focus Test: Added a dedicated autofocus test (test_tui_login_provider_search_autofocus) that utilizes native event flushing to test focus state behavior independently.
The isolated tests passed completely clean locally across consecutive test runs.
cc @ShreyanshVaibhaw — since this issue primarily popped up on your environment, could you check out this branch and verify if it permanently kills the flake on your machine?
Bash